package com.borqsprocessmanager.util;

import com.borqsprocessmanager.ConfigParams;
import com.borqsprocessmanager.info.BaseBatteryAlsInfo;

public class BatteryStatsAnalysis {

    private static final String TAG = "BatteryStatsAnalysis";

    public static boolean isOutrideBaseLine(long time, BaseBatteryAlsInfo info) {
        long minTime = ConfigParams.POWER_MIN_TIME_BASELINE;
        if (time > minTime) {
            Log.v(TAG, "time > minTime=" + time + "___minTime=" + minTime);
            float argTimeM = info.getArgTimeM();
            Log.v(TAG, "argTimeM=" + argTimeM);
            if (argTimeM == 0) {
                return false;
            }
            float timeM = MathUtil.divide(time, ConfigParams.POWER_BASELINE, 2);
            Log.v(TAG, "timeM=" + timeM);
            float poor = MathUtil.divide(timeM, argTimeM, 2);
            Log.v(TAG, "poor=" + poor);
            if (poor > ConfigParams.POWER_RATE_BASELINE) {
                return false;
            }
        }
        return true;
    }

    public static void setArgTime(long time, BaseBatteryAlsInfo info) {
        float timeM = (float) MathUtil.divide(time,
                ConfigParams.POWER_BASELINE, 2);
        Log.v(TAG, "setAcerageTime=" + timeM);
        info.setArgTimeM(timeM);
    }

    public static void initArgTime(BaseBatteryAlsInfo info) {
        info.initArgTime();
    }

    public static void getArgTime() {

    }
}
